#ifndef SCHEDULER_FACTORY_H
#define SCHEDULER_FACTORY_H

#include <scheduler/abstract_scheduler.h>

namespace scheduler
{

template<class T>
class SchedulerFactory
{
public:
    /**
     * @brief:  创建调度实例
     * @author: maxu
     */
    template<typename... Args>
    static std::shared_ptr<T> createScheduler(const std::string &name, Args... args)
    {
        auto scheduler = std::make_shared<T>(name, args...);
        auto ptr = dynamic_cast<scheduler::AbstractScheduler *>(scheduler.get());
        if (ptr)
        {
            ptr->initialize();
        }
        else
        {
            EASE_ERROR("factory create scheduler, no initialize");
        }
        return scheduler;
    }
};

}

#endif //SCHEDULER_FACTORY_H
